using System;
using System.Collections.Generic;
using System.Text;

namespace ConsolePlayer
{
    class Program
    {
        static void Main(string[] args)
        {
			List<object> extensions = Extensions.Instance.objList;
			for (int index = 0; index < Extensions.Instance.Count; index++)
			{
				IExtension ext = Extensions.Instance[index];
				if (ext != null)
				{
					object command = ext.ParseCommandLine(args);
					if (command != null)
					{
						extensions.Add(command);
					}
				}
			}


            ICommand[] commands = Commandor.GetCommand(args);
            foreach (ICommand command in commands)
            {
                command.Action();
            }
			ListManager.Instance.Flush();

			//now for extensions
			foreach (object o in extensions)
			{
				ICommand command = o as ICommand;
				if (command != null)
					command.Action();
			}


			Extensions.Instance.Flush();
			Supports.Instance.Flush();
        }
	}
}
